import 'dart:convert';
import 'package:ichinesereader/exam/dto/assessment_question_details.dart';

WordCardQuestionsResult wordCardQuestionsResultFromJson(String str) =>
    WordCardQuestionsResult.fromJson(json.decode(str));

String wordCardQuestionsResultToJson(WordCardQuestionsResult data) =>
    json.encode(data.toJson());

class WordCardQuestionsResult {
  WordCardQuestionsResult({
    this.status,
    this.message,
    this.result,
  });

  int? status;
  String? message;
  Result? result;

  factory WordCardQuestionsResult.fromJson(Map<String, dynamic> json) =>
      WordCardQuestionsResult(
        status: json["status"],
        message: json["message"],
        result: Result.fromJson(json["result"]),
      );

  Map<String, dynamic> toJson() => {
        "status": status,
        "message": message,
        "result": result?.toJson(),
      };
}

class Result {
  Result({this.handWriting, this.choice, this.vanish, this.match, this.option});

  List<String>? handWriting;
  List<QuestionDetails>? choice;
  List<QuestionDetails>? vanish;
  List<QuestionDetails>? match;
  List<QuestionDetails>? option;

  factory Result.fromJson(Map<String, dynamic> json) => Result(
      handWriting: json["handWriting"] != null
          ? List<String>.from(json["handWriting"].map((x) => x))
          : null,
      choice: json["choice"] != null
          ? List<QuestionDetails>.from(
              json["choice"].map((x) => QuestionDetails.fromJson(x)))
          : null,
      vanish: json["vanish"] != null
          ? List<QuestionDetails>.from(
              json["vanish"].map((x) => QuestionDetails.fromJson(x)))
          : null,
      match: json["match"] != null
          ? List<QuestionDetails>.from(
              json["match"].map((x) => QuestionDetails.fromJson(x)))
          : null,
      option: json["option"] != null
          ? List<QuestionDetails>.from(
              json["option"].map((x) => QuestionDetails.fromJson(x)))
          : null);

  Map<String, dynamic> toJson() => {
        "handWriting": handWriting != null
            ? List<dynamic>.from(handWriting!.map((x) => x))
            : null,
        "choice": choice != null
            ? List<dynamic>.from(choice!.map((x) => x.toJson()))
            : null,
        "vanish": vanish != null
            ? List<dynamic>.from(vanish!.map((x) => x.toJson()))
            : null,
        "match": match != null
            ? List<dynamic>.from(match!.map((x) => x.toJson()))
            : null,
        "option": option != null
            ? List<dynamic>.from(option!.map((x) => x.toJson()))
            : null
      };
}

// class WordQuestionResult {
//   WordQuestionResult({
//     this.question,
//     this.id,
//     // this.content,
//   });

//   List<QuestionItem>? question;
//   String? id;
//   // Content? content;

//   factory WordQuestionResult.fromJson(Map<String, dynamic> json) =>
//       WordQuestionResult(
//         question: json["question"] != null
//             ? List<QuestionItem>.from(
//                 json["question"].map((x) => QuestionItem.fromJson(x)))
//             : null,
//         id: json["id"],
//         // content: Content.fromJson(json["content"]),
//       );

//   Map<String, dynamic> toJson() => {
//         "question": question != null
//             ? List<dynamic>.from(question!.map((x) => x.toJson()))
//             : null,
//         "id": id,
//         // "content": content?.toJson(),
//       };
// }
